 
<template>
  <view class="apply-result">
	<uni-icons type="checkbox-filled" size="90" color="#277EEF" v-if="transferBatch.successAmount==transferBatch.totalAmount"></uni-icons>
	<u-icon name="clock-fill" color="#b9b417" size="70" v-else></u-icon>
	<view class="click" v-if="transferBatch.successAmount==transferBatch.totalAmount">提现成功</view>
	<view class="click"v-else style="color:#b9b417;">提现中</view>
	<view class="apply-result__tip">
	  ￥
	  <text>{{transferBatch.totalAmount || ''}}</text>
	   
	</view>
	<view class="woodsbtn" @click="back"  v-if="transferBatch.successAmount==transferBatch.totalAmount"
	 style="color:#277EEF;background-color: #fff;border: 1px solid #277EEF;">
	  完成
	</view>
	<view class="woodsbtn" @click="back"  v-else
	 style="color:#b9b417;background-color: #fff;border: 1px solid #b9b417;">
	  返回
	</view>
  </view>
</template>
 

<script>
	import {getWeiXinByIdAPI} from "@/api/user.js"
	export default {
		data() {
			return {
 				id:"",
				transferBatch:{
					
				},
				timer: null, // 新增的定时器变量
			}
		},
		/*
		appid: "wx32674d431df22cea"
		batchId: "131000708039406696437442024091388100883267"
		batchName: "用户128791提现到微信零钱1元"
		batchRemark: "用户128791提现到微信零钱1元"
		batchStatus: "PROCESSING"
		batchType: "API"
		closeReason: null
		createTime: "2024-09-13T22:15:58+08:00"
		failAmount: null
		failNum: null
		mchid: "1681340006"
		outBatchNo: "T202409132215581"
		successAmount: 0
		successNum: 0
		totalAmount: 1
		totalNum: 1
		updateTime: "2024-09-13T22:16:03+08:00"
		
		
		*/ 
		onLoad(option) {
			this.id=option.id
			this.getinfo()
		},
		methods: {
			getinfo(){
				if (this.timer) {
					clearTimeout(this.timer); // 清除之前的定时器
				}
				uni.showLoading({
					title:'获取提现进度'
				})
				getWeiXinByIdAPI({id:this.id}).then(res=>{
					this.transferBatch=res.transferBatch
					if(res.transferBatch.batchStatus!='FINISHED'){
						this.timer = setTimeout(()=>{
							this.getinfo()
						},3000)
					}
					uni.hideLoading()
					
				})
			},
			back(){
				uni.redirectTo({
					url:'/pages/my/integral/jiejinbi'
				})
			}
		}
	}
</script>


<style lang="scss" scoped>
.apply-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  padding-top: 120rpx;
  background-color: #fff;
  .click {
    margin-bottom: 56rpx;
    font-size: 32rpx;
	color: $uni-color-primary;
  }
  &__tip {
    margin-bottom: 280rpx;
    font-size: 48rpx;
    font-weight: bold;
    color: #333;
    text {
      font-size: 72rpx;
    }
  }
}
</style>

